#include "Sql_list.h"

Elenemt_data Stu_data[50] =
    {
        {.name = "刘备", .sex = "男", .sco = 60, .age = 18, .id = 1},
        {.name = "关羽", .sex = "男", .sco = 60, .age = 18, .id = 2},
        {.name = "张飞", .sex = "女", .sco = 60, .age = 18, .id = 3},
        {.name = "诸葛", .sex = "男", .sco = 60, .age = 18, .id = 4},
        {.name = "赵云", .sex = "男", .sco = 60, .age = 18, .id = 5},
        {.name = "马超", .sex = "男", .sco = 60, .age = 18, .id = 6},
        {.name = "祝融", .sex = "女", .sco = 60, .age = 18, .id = 7},
        {.name = "小乔", .sex = "女", .sco = 60, .age = 18, .id = 8},
        {.name = "大乔", .sex = "女", .sco = 60, .age = 18, .id = 9},
        {.name = "貂蝉", .sex = "女", .sco = 60, .age = 18, .id = 10}};

void test(void)
{
    // 创建 表
    Sql_list S_guo;
    Sql_list S_guo1;
    Sql_list *L = &S_guo;
    Sql_list *L1 = &S_guo1;

    // 初始化
    Init_Sql_List(L);
    Init_Sql_List(L1);

    printf("\n\n=============== 插入 ===============\n\n");
    // 插入
    tail_insert_list(L, Stu_data[0]);
    tail_insert_list(L, Stu_data[1]);
    tail_insert_list(L, Stu_data[2]);
    tail_insert_list(L, Stu_data[3]);
    tail_insert_list(L1, Stu_data[4]);
    tail_insert_list(L1, Stu_data[5]);
    tail_insert_list(L1, Stu_data[6]);
    tail_insert_list(L1, Stu_data[7]);
    // 打印
    printf_Sql_List(L);
    printf_Sql_List(L1);

    printf("\n\n=============== 顺序表的合并 ===============\n\n");

    printf_Sql_List(Merge_Sql_Lists(L, L1));

    // printf("\n\n=============== 删除 ===============\n\n");
    // tail_del_list(L);
    // printf_Sql_List(L);

    printf("\n\n=============== 按位置插入 ===============\n\n");
    pos_insert_list(L, 3, Stu_data[6]);
    printf_Sql_List(L);

    // printf("\n\n============== 按位置删除 ===============\n\n");
    // pos_del_list(L, 2);
    // printf_Sql_List(L);

    // printf("\n\n============== 按名字查找 ===============\n\n");
    // find_by_name(L, "张飞");

    // printf("\n\n============== 按位置查找 ===============\n\n");
    // find_by_index( L, 1);

    // // printf("\n\n============== 清空 ===============\n\n");
    // // Clear_Sql_List(L);

    // printf("\n\n============== 判空 ===============\n\n");
    // IsEmpty_Sql_List(L);
}

int main(int argc, char const *argv[])
{
    test();
    return 0;
}